<?php
/**
 * Created by PhpStorm.
 * User: MSQ
 * Date: 2021/9/24
 * Time: 14:27
 */

namespace App\Utils;


use EasySwoole\Log\LoggerInterface;

/**
 * Class LogHelp
 * @package App\Utils
 */
class LogHelp
{
    /**
     * 打印到控制台【不记录日志】
     * @param string|null $msg
     * @param int $logLevel
     * @param string $category
     */
    public static function console(?string $msg, int $logLevel = LoggerInterface::LOG_LEVEL_DEBUG, string $category = 'debug')
    {
        $log = \EasySwoole\EasySwoole\Logger::getInstance();
        $log->console($msg, $logLevel, $category);
    }

    /**
     * debug(0级)
     * @param string|null $msg
     * @param string $category
     */
    public static function debug(?string $msg, string $category = 'debug')
    {
        $log = \EasySwoole\EasySwoole\Logger::getInstance();
        $log->debug($msg, $category);
    }

    /**
     * info(1级)
     * @param string|null $msg
     * @param string $category
     */
    public static function info(?string $msg, string $category = 'info')
    {
        $log = \EasySwoole\EasySwoole\Logger::getInstance();
        $log->info($msg, $category);
    }

    /**
     * notice(2级)
     * @param string|null $msg
     * @param string $category
     */
    public static function notice(?string $msg, string $category = 'notice')
    {
        $log = \EasySwoole\EasySwoole\Logger::getInstance();
        $log->notice($msg, $category);
    }

    /**
     * notice(3级)
     * @param string|null $msg
     * @param string $category
     */
    public static function waring(?string $msg, string $category = 'waring')
    {
        $log = \EasySwoole\EasySwoole\Logger::getInstance();
        $log->waring($msg, $category);
    }

    /**
     * notice(4级)
     * @param string|null $msg
     * @param string $category
     */
    public static function error(?string $msg, string $category = 'error')
    {
        $log = \EasySwoole\EasySwoole\Logger::getInstance();
        $log->error($msg, $category);
    }
}
